﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Routing;

namespace Api.WebForm
{
    public class BackendRoute
    {
        public static void Register(RouteCollection routes)
        {
            RouteValueDictionary defaults = new RouteValueDictionary();
            defaults.Add("id", "*");
            defaults.Add("name", "*");

            RouteValueDictionary constraints = new RouteValueDictionary();
            constraints.Add("id", new Int32RangeConstraint(1, 1000));
            constraints.Add("httpMethod", new HttpMethodConstraint("get"));

            RouteValueDictionary dataTokens = new RouteValueDictionary();
            dataTokens.Add("id", "*");
            dataTokens.Add("name", "*");

            routes.MapPageRoute("backend", "backend/{name}/{id}", "~/modules/admin.aspx", true, defaults, constraints, dataTokens);
        }
    }
}